
import datetime
import random

def getdate(beforeOfDay):
    today = datetime.datetime.now()
    # 计算偏移量
    offset = datetime.timedelta(days=-beforeOfDay)
    # 获取想要的日期的时间
    re_date = (today + offset).strftime('%Y-%m-%d')
    return re_date

    
t = 'INSERT INTO "WB_TBL_DD_LME_PRICE"("ID", "VARIETY_ID", "M3_BUY", "M27_BUY", "M27_SELL", "M15_BUY", "M15_SELL", "M3_SELL", "CASH_BUY", "CASH_SELL", "USING_FLAG", "GROUP_ID", "ORGAN_ID", "ORGAN_LEVEL_CODE", "DELETE_FLAG", "CREATE_USER", "CREATE_DATE", "UPDATE_USER", "UPDATE_DATE", "VERSION_NUM", "TRADE_DATE", "CONTRACT_ID", "DATA_SOURCE", "OPEN_PRICE", "CLOSE_PRICE", "MAX_PRICE", "MIN_PRICE", "SETTLEMENT_PRICE") VALUES (WB_SEQ_DD_LME_PRICE.nextval'
t1 = ", 'Cu', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, '0', '获取用户信息为空', SYSDATE, '获取用户信息为空', SYSDATE, '1', "
t2 = " '0');"


r = ''
for i in range(100):
    TRADE_DATE = getdate(i)
    random.randint(1,10) 

    # p1 = 5904
    # p2 = 5904
    # p3 = 5904
    # p4 = 5904

    p3 = random.randint(6500,7000)
    p4 = random.randint(6000,6500)
    p2 = random.randint(p4,p3)
    p1 = random.randint(p4,p3)

    r += t + t1 + "TO_DATE('" + TRADE_DATE + "', 'YYYY-MM-DD'), '8', '0', " + "'" + str(p1) + "', "  + "'" + str(p2) + "', " + "'" + str(p3) + "', " + "'" + str(p4) + "', " + t2 + "\n"


print(r)